<template>
  <section>
    <!-- 面包屑 -->
 <breadcrumbs></breadcrumbs>
    <div class="data-container scroll-table">
      <div>
        <div class="wenzhang">积分商品详情</div>
      </div>

      <div>
        <div class="ind-title lh50 f16"><span class="biaoti">商品名称：</span>{{wenzhanglist.goodsName}}</div>
      </div>

      <div>
        <div class="ind-title lh50 f16"><span class="biaoti">兑换积分：</span>{{wenzhanglist.goodsIntegral}}</div>
      </div>

      <div>
        <div class="ind-title lh50 f16"><span class="biaoti">商品库存：</span>{{wenzhanglist.goodsStock}}</div>
      </div>

      <div>
        <div class="ind-title lh50 f16"><span class="biaoti">商品封面：</span><img :src=wenzhanglist.goodsCover alt="" class="fengmian"></div>
      </div>

       <div>
        <div class="ind-title lh50 f16"><span class="biaoti">商品轮播面：</span>
         <el-upload
            :disabled="true"
            :action="importFileUrl"
            list-type="picture-card"
            :accept="'image/*'"
            :show-file-list="true"
            :file-list="filesEdit"
      
          >
         </el-upload>
        
        </div>
      </div>

      <div>
        <div class="ind-title lh50 f16"><span class="biaoti">商品详情：</span><span v-html="wenzhanglist.integralGoodsInfo"></span></div>
      </div>

    </div>
   
  </section>
</template>

<script>

import btns from "@/components/btns.vue";
import Editor from "@/components/edit";
import mixins from "@/utils/mixins";
import breadcrumbs from "@/components/breadcrumbs.vue";
export default {
  mixins: [mixins],
  components: {
    
    btns,
    Editor,
    breadcrumbs,
  },
  data() {
    var FengValidate = (rule, value, callback) => {
      // console.log(this.addfile);
      if (this.addfile == "") {
        callback(new Error("请选择封面图片"));
      }
      // if (value == null || value == '') {
      //   this.activeNames = ['2'];
      // }
    };
    return {
      editImgFile:[],
      filesEdit:[],
        agencyId: this.$route.query.jid,
        wenzhanglist:[],
        importFileUrl: this.GLOBAL.imgBaseUrl,
    };
  },
  created() {

    this.fenleilist();

  },
  methods: {
    getUrlListEdit (item) {
      this.$message({
        type: 'success',
        message: '图片上传成功'
      });
      // console.log('filesEdit', this.filesEdit);
      // this.EditForm.addfile = item;
      // this.$set(this.EditForm, 'affile', item);
      let list = [];
      let obj = {};
      obj.index = 1;
      obj.url = item;
      this.filesEdit.push(obj);
      // this.filesEdit.forEach(() => {
      //   list.push(item.data.url)
      // })
      // console.log('11112323232123123', this.filesEdit);
      // console.log(list);
      // console.log('add', this.editForm.addfile);
      // list.push(this.EditForm.addfile);
      // this.filesEdit = list;
      // 
      console.log('editImgList============================', this.filesEdit);
    },
    beforeAvatarUpload (file) {
      console.log(file, 231232)
      const isLt2M = file.size / 1024 / 1024 < 10;
      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 10MB!');
      }
      return isLt2M;
    },
    
    fenleilist(){
          {
          this.$api.integral.jifengoodslist({
              id:this.agencyId
          
          }).then(d => {
            if (d.code == 200) {
              this.wenzhanglist = d.data


              let file = this.wenzhanglist.goodsBanner.split(',');
            file.forEach((item, index) => {
          if (item != '') {
            let obj = {};
            obj.url = item;
            obj.index = index;
            this.editImgFile.push(obj);
          }
        })
        this.filesEdit = this.editImgFile;
        console.log("=============================="+this.filesEdit)
            }
          })
        }
      },
  }
};
</script>

<style lang="scss" scoped>
.dialog-footer {
  margin-top: 50px;
}
.img-feng {
  width: 120px;
  height: 120px;
}
.goods {
  width: 500px;
}
.icon {
  display: flex;
  justify-content: space-between;
  i {
    font-size: 25px;
  }
}
.fengmian{
    height: 10%;
    width: 10%;
}
.wenzhang{
    font-size: 20px;
    font-weight: 700;
}
.biaoti{
    font-size: 15px;
    font-weight: 700;
}
</style>
